﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Northwind.Domain;

namespace Ex03
{
    class Program
    {
        static void Main(string[] args)
        {
            var db = new NorthwindEntities();
            // Again, we can see in the SQL results pane that the following query is evaluated
            // in a single SQL statement.

            var query = from c in db.Customers
                select new { c.Name, c.Purchases };
            foreach (var entry in query)
            {
                Console.WriteLine("{0}",entry.Name);
                foreach (var p in entry.Purchases)
                {
                    Console.WriteLine("\t{0},{1},{2}",p.ID,p.Description,p.Date);
                }
                Console.WriteLine();
            }
            Console.ReadKey();
        }
    }
}
